Skip to main content

backgroundBehavior

Type

property

Summary

Specifies whether a group behaves as a background and come after it's card on the message path.

Syntax

set the backgroundBehavior of <group> to {true | false}

Description

Use the backgroundBehavior property to make groups behave like backgrounds and to automatically place groups on newly created cards.

Only top-level groups may be background groups; an attempt to set the backgroundBehavior of a nested group to true throws an error.

A background group differs from a normal group in the following ways:

  • The group's script is placed behind the card in the message path for
    any message not originating from a control within it.
* The group can be referred to using the \'background\' chunk.
* The card on which the group is placed receives preOpenBackground /
openBackground / closeBackground messages (these messages occur
instead of preOpenControl / openControl / closeControl being
sent to the group itself).
* The group can be placed onto multiple cards.
* If the group is placed on \'this card\' at the time a new card is
created, it is automatically placed onto the new (empty) card.

A background group is also a shared group. This means that when the backgroundBehavior is set to true, the sharedBehavior is also set to true (if it is not already).

note

Setting the backgroundBehavior of a group to false does not affect the sharedBehavior property, in particular the latter is not be set to false until it is explicitly done so.

note

Only groups whose backgroundBehavior is true appear in the list reported by the backgroundNames and backgroundIDs properties.

note

If a stack created in a version of LiveCode earlier than 1.1 is opened in 1.1 or later, the backgroundBehavior of all its groups is set to true by default. This also applies to imported HyperCard stacks.

Examples

set the backgroundBehavior of group 1 to false
set the backgroundBehavior of the last group to true
if the backgroundBehavior of group "backgroundObjects" is true then
-- do something
end if

message: preOpenBackground, openControl, openBackground, closeBackground, preOpenControl, closeControl

property: HCAddressing, sharedBehavior, backgroundNames, backgroundIDs, dynamicPaths

command: place, send

control structure: pass

Compatibility and Support

Introduced

LiveCode 1.1

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?